home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak Vol A-4
/
(Vol A-4) Vol. A4.iso
/
Games
/
winterfood.swf
/
scripts
/
frame_11
/
DoAction.as
Wrap
Text File
|
2008-03-13
|
4KB
|
182 lines
function StartGame()
{
_root.Timer = "00:00";
_root.StartTime = getTimer();
_root.Score = 0;
AddAfterThis = 1000;
LastScore = 0;
NextScore = AddAfterThis;
_root.Life = 3;
_root.LifeMC.gotoAndStop(3 - _root.Life + 1);
_root.TotalCount = 0;
_root.You.gotoAndPlay("Run1");
_root.GameOverMC._visible = false;
_root.GameOverMC.gotoAndStop(1);
_root.SpeakMC._visible = false;
_root.DuckY = 196;
_root.MeX = 94;
_root.MeY = 142.85;
_root.Me._xscale = Math.abs(_root.Me._xscale);
_root.Me._x = _root.MeX;
_root.Me.gotoAndStop("JumpDown");
_root.Base = 0;
_root.KeyActive = true;
_root.IsFood = true;
_root.DuckCount = 0;
_root.GameOver = false;
}
function ReStartGame()
{
_root.Life -= 1;
if(_root.Life <= 0)
{
_root.LifeMC.gotoAndStop(4);
_root.GameOver = true;
_root.GameOverMC._visible = true;
_root.GameOverMC.gotoAndPlay(1);
}
else
{
_root.LifeMC.gotoAndStop(3 - _root.Life + 1);
_root.Me._x = _root.MeX;
_root.Me.gotoAndStop(1);
_root.Base = 0;
_root.KeyActive = true;
_root.IsFood = true;
_root.DuckCount = 0;
}
}
function CheckDuck()
{
if(_root.Base > 0 && _root.Base < 6 && _root["Duck" + _root.Base].Moving == false)
{
this["Duck" + _root.Base].gotoAndPlay("Down");
this["Duck" + _root.Base].SitDown = true;
}
else
{
KillPlayer();
}
}
function KillPlayer()
{
if(_root.IsFood == true)
{
_root.Me.gotoAndPlay("Dead1");
}
else
{
_root.Me.gotoAndPlay("Dead2");
}
}
function MoveMan(Dir)
{
if(_root.GameOver == true)
{
return undefined;
}
_root.Duck1.SitDown = false;
_root.Duck2.SitDown = false;
_root.Duck3.SitDown = false;
_root.Duck4.SitDown = false;
_root.Duck5.SitDown = false;
_root.Me._y = _root.MeY;
if(Dir == "Left")
{
if(_root.Base == 0)
{
return undefined;
}
if(_root.Base == 1)
{
if(_root.IsFood == false)
{
if(_root.Me._xscale < 0)
{
_root.Me._xscale = Math.abs(_root.Me._xscale);
}
_root.Me._x = _root.MeX;
_root.Me.gotoAndPlay("Arrive");
_root.Base = 0;
_root.IsFood = true;
return undefined;
}
}
if(_root.Me._xscale > 0)
{
_root.Me._xscale = - Math.abs(_root.Me._xscale);
}
if(_root.Base == 5)
{
_root.Me._x = _root["Duck" + _root.Base]._x + 64;
JumpMe();
_root.Base -= 1;
}
else
{
n = _root.Base + 1;
_root.Me._x = _root["Duck" + n]._x;
JumpMe();
_root.Base -= 1;
}
}
else if(Dir == "Right")
{
if(_root.Me._xscale < 0)
{
_root.Me._xscale = Math.abs(_root.Me._xscale);
}
if(_root.Base == 0)
{
_root.Me._x = _root.MeX;
_root.Me.gotoAndPlay("JumpDown");
_root.Base = 1;
}
else if(_root.Base == 5)
{
if(_root.IsFood == true)
{
_root.Me.gotoAndPlay("Give");
_root.IsFood = false;
}
}
else if(_root.Base == 1)
{
_root.Me._x = _root.MeX;
JumpMe();
_root.Base += 1;
}
else
{
n = _root.Base - 1;
_root.Me._x = _root["Duck" + n]._x;
JumpMe();
_root.Base += 1;
}
}
}
function JumpMe()
{
if(_root.IsFood == true)
{
_root.Me.gotoAndPlay("Jump1");
}
else
{
_root.Me.gotoAndPlay("Jump2");
}
}
function IncreaseLife(Old, New)
{
if(Old < NextScore && New >= NextScore)
{
NextScore += AddAfterThis;
if(_root.Life < 3)
{
_root.Life += 1;
_root.LifeMC.gotoAndStop(3 - _root.Life + 1);
}
}
}
StartGame();